from django.db import models

from course.models import Course


class Teacher(models.Model):
    """
    教师表
    """
    works = models.IntegerField(default=0, verbose_name="工作年限")
    style = models.CharField(max_length=512, verbose_name='教学特点')
    work_title = models.CharField(max_length=32, verbose_name='工作职位')

    # course_num = models.IntegerField(default=0, verbose_name='课程数') # todo 直接关联到课程

    class Meta:
        db_table = "teacher"


class Organization(models.Model):
    """
      机构表
    """
    ORG_TYPE_CHOICES = (
        (0, '培训机构'),
        (1, '高校'),
        (2, '个人'),
    )
    name = models.CharField(max_length=64, verbose_name='结构名字')
    introduction = models.CharField(max_length=1024, verbose_name='结构介绍')
    address = models.CharField(max_length=512, verbose_name='机构地址')
    classic_course = models.ForeignKey(to=Course, related_name='classic_course', on_delete=models.SET_DEFAULT,
                                       default=0, verbose_name='机构经典课程')
    org_type = models.IntegerField(choices=ORG_TYPE_CHOICES, verbose_name='机构类型', default=0)

    class Meta:
        db_table = "organization"
